package com.wd.servlet;

import com.wd.service.BlogService;
import com.wd.service.CommentService;
import com.wd.service.impl.BlogServiceImpl;
import com.wd.service.impl.CommentServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @Author: 悠久的苍穹
 * @Date: 2020/11/7 16:09
 * @Description: ${description}
 * @Version: 1.0
 */
@WebServlet(urlPatterns = "/ReceivePraiseServlet")
public class ReceivePraiseServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        BlogService blogService = new BlogServiceImpl();
        int id = Integer.parseInt(request.getParameter("blogid"));
        int star = Integer.parseInt(request.getParameter("star"));
        try {
            blogService.updStar(id,star);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }
}
